// #ifndef H5 || MP
const animation = uni.requireNativePlugin('animation')
// #endif
export default {
	data() {
		return {}
	},
	methods:{
		// 弹幕item开始跑起来
		getDanmu_pao_animation(e){
			// #ifndef H5 || MP
			// 此弹幕只在app端，小程序后续增加
			let ref = e.el
			let num = e.num
			let index = e.itemIndex // + 1 // 由于从0开始
			let slateX = this.getTranslateX(e)
			let durationTime = this.duration //弹幕动画时间
			return new Promise((resolve,reject) =>{
			    animation.transition(ref, {
			        styles: {
			            //backgroundColor: '#05DFC7',
			            transform: `translateX(${slateX})`,
			            transformOrigin: 'center center',
			            //opacity:0
			        },
			        duration: durationTime, //ms
			        timingFunction: 'linear',
			        delay: 0 //ms
			    }, () => {
			        
			        let options = {
			            ref: ref.attr.id, //弹幕ref-id 
			            num, //轨道id
			            index, //弹幕item项(索引)
			        }
			        resolve(options)
			        // 只要删除数组的第一项，就会有bug，导致出现重叠
			    })
			})
			// #endif
		},
	}
}